/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dosideas.restlet.application;

import com.dosideas.restlet.domain.Persona;
import com.dosideas.restlet.resource.PersonaResource;
import com.dosideas.restlet.resource.PersonasResource;
import java.util.ArrayList;
import java.util.Collection;
import org.restlet.Application;
import org.restlet.Restlet;
import org.restlet.routing.Router;

/**
 *
 * @author Emiliano
 */
public class PersonaApplication extends Application {
    
    private final Collection<Persona> personas = new ArrayList<Persona>();

    @Override
    public Restlet createInboundRoot() {
        Router router = new Router(getContext());
        // Define un route para el recurso de lista de personas.
        router.attach("/persona", PersonasResource.class);
        // Define un route para el recurso persona.
        router.attach("/persona/{nombre}", PersonaResource.class);
        

        return router;
    }

    /**
     * Retorna la colecction de personas.
     * @return Collection de personas.
     */
    public Collection<Persona> getPersonas() {
        return personas;
    }
    
    
}
